<div id="formbox" >
	<div class="padding">
		<div id="feedback-success">
			<p>Das Projekt wurde erfolgreich erstellt/bearbeitet. <a href="/<?= Zend_Registry::get('Zend_Locale') ?>/projects/">(zurück zur Übersicht)</a></p>
		</div>
		<div id="feedback-error">
			<p>Beim Erstellen/Bearbeiten des Projekts gab es einen Fehler. Bitte kontaktieren Sie den Administrator. <a href="/<?= Zend_Registry::get('Zend_Locale') ?>/projects/">(zurück zur Übersicht)</a></p>
		</div>
		<form method="post" id="projectform" name="projectform" action="#">	
			<fieldset style="border:1px solid #ccc;">						
				<legend><?php echo $this->translate("Neues Projekt erstellen"); ?></legend>
				<div class="ffield">
					<label for="ptitle" ><?php echo $this->translate("Titel"); ?><sup>*</sup></label>
					<input class="input" type="text" id="ptitle" name="ptitle" value="<?= $this->project['ptitle']; ?>" /> <br />
				</div>
				<div class="ffield">
					<div id="clientlist">
						<label for="clients" ><?php echo $this->translate("Kunden"); ?><sup>*</sup></label>
						<?php 
						if(count($this->clients) > 0) {
							foreach($this->clients as $client) { ?>
							<input class="input tag" type="text" id="clients" name="tag[<?= $client['uid'] ?>-a]" value="<?= $client['firstname']." ".$client['lastname'] ?>" />
							<?php }
						} else { ?>
							<input class="input tag" type="text" id="clients" name="tag[3-a]" value="" />
						<?php } ?>
						<br />
					</div>
				</div>
				<div class="ffield">
					<label for="default_costid" ><?php echo $this->translate("Stundensatz"); ?><sup>*</sup></label>
					<select class="input" id="default_costid" name="default_costid">											
						<option value="0">(kein Stundensatz)</option>
						<?php 
						foreach($this->costs as $cost) { ?>							
							<option value="<?php print($cost['costid']); ?>" <?php if($this->project['default_costid'] == $cost['costid']) echo 'selected="selected"'; ?>>
								<?php echo $cost['price']."€ "." (".$cost['comment'].")"; ?>
							</option>
						<?php } ?>
					</select>
					<br />
				</div>
				<div class="ffield">
					<label for="contact_mail" ><?php echo $this->translate("Kontakt E-Mail Adresse")." ".$this->translate("(für Rechnungen und Infomails)"); ?><sup>*</sup></label>
					<input class="input" type="text" id="contact_mail" name="contact_mail" value="<?= $this->project['contact_mail']; ?>" /> <br />
				</div>
				<div class="ffield">
					<label for="clientid" ><?php echo $this->translate("Verwende die Rechnungsadresse von Kunde"); ?><sup>*</sup></label>
					<select class="input" id="clientid" name="clientid">											
						<?php 
						foreach($this->allclients as $client) { ?>
							<option value="<?php print($client['uid']); ?>" <?php if($this->billing['clientid'] == $client['uid']) echo 'selected="selected"'; ?>>
								<?php echo $client['firstname']." ".$client['lastname']; ?>
							</option>
						<?php } ?>
					</select>
					<br />
				</div>
				<div class="ffield">
					<label for="repetition" ><?php echo $this->translate("Abrechnungsintervall"); ?><sup>*</sup></label>
					<select class="input" id="repetition" name="repetition">
						<option value="manually" <?php if($this->billing['repetition'] == "manually") echo 'selected="selected"' ?>>manuell (on demand)</option>												
						<option value="single" <?php if($this->billing['repetition'] == "single") echo 'selected="selected"' ?>>einmalig (fixes Datum)</option>
						<option value="weekly" <?php if($this->billing['repetition'] == "weekly") echo 'selected="selected"' ?>>wöchentlich</option>
						<option value="monthly" <?php if($this->billing['repetition'] == "monthly") echo 'selected="selected"' ?>>monatlich</option>
					</select>
					<br />
				</div>
				<div class="ffield" id="repetition_detail">
					<label for="" ><?php echo $this->translate("Abrechnungszeitpunkt"); ?><sup>*</sup></label>
					<input <?php if($this->billing['repetition'] != "manually") echo 'style="display:none;"'; ?> class="input" type="text" id="ondemand" name="ondemand" value="" disabled="disabled" />
					<input <?php if($this->billing['repetition'] != "single") echo 'style="display:none;"'; ?> class="input" type="text" id="paydate" name="paydate" value="<?php if($this->billing['paydate'] != "") print(date("d.m.Y", $this->billing['paydate'])); ?>" />
					<select <?php if($this->billing['repetition'] != "weekly") echo 'style="display:none;"'; ?> class="input" id="payweekday" name="payweekday">
						<option value="Mon" <?php if($this->billing['payweekday'] == "Mon") echo 'selected="selected"' ?>>montags</option>												
						<option value="Tue" <?php if($this->billing['payweekday'] == "Tue") echo 'selected="selected"' ?>>dienstags</option>
						<option value="Wed" <?php if($this->billing['payweekday'] == "Wed") echo 'selected="selected"' ?>>mittwochs</option>
						<option value="Thu" <?php if($this->billing['payweekday'] == "Thu") echo 'selected="selected"' ?>>donnerstags</option>
						<option value="Fri" <?php if($this->billing['payweekday'] == "Fri") echo 'selected="selected"' ?>>freitags</option>
						<option value="Sat" <?php if($this->billing['payweekday'] == "Sat") echo 'selected="selected"' ?>>samstags</option>
						<option value="Sun" <?php if($this->billing['payweekday'] == "Sun") echo 'selected="selected"' ?>>sonntags</option>
					</select>
					<select <?php if($this->billing['repetition'] != "monthly") echo 'style="display:none;"'; ?> class="input" id="payday" name="payday">
						<?php 
						for($i = 1; $i < 29; $i++) { ?>
							<option value="<?php print($i); ?>" <?php if($this->billing['payday'] == $i) echo 'selected="selected"' ?>><?php print("immer am ".$i.". des Monats"); ?></option>
						<?php } ?>
					</select>
					<br />
				</div>
				<div class="ffield">
					<label for="max_per_period" ><?php echo $this->translate("Kostenlimit pro Abrechnungsintervall")." ".$this->translate("(in €)"); ?><sup>*</sup></label>
					<input class="input" type="text" id="max_per_period" name="max_per_period" value="<?= $this->billing['max_per_period']; ?>" /> <br />
				</div>
				<div class="submitbox" >
					<?php if($this->logged != true) { ?>
					<div class="reset">
						<p><a href="#" onclick="document.projectform.reset(); return false"><?php echo $this->translate("Löschen"); ?></a></p>
					</div>
					<?php } ?>
					<div class="submit">
						<p><a id="submit-projectform" href="#"><?php echo $this->translate("Abschicken"); ?></a></p>
					</div>
				</div>
				<input type="hidden" name="edittype" id="edittype" value="<?php echo $this->edittype; ?>" />
				<input type="hidden" name="pid" id="pid" value="<?php echo $this->project['pid']; ?>" />
			</fieldset>
			<div style="margin-top: 25px;"></div>  
		</form>
	</div>
</div>